import Vue from 'vue'
import VueRouter from 'vue-router'
import App from '../App.vue'

Vue.use(VueRouter)

const routes = [
    {
        path: '/',
        name: 'home',
        redirect: '/dashBoard',
    },
    {
        path: '/login',
        name: 'login',
        component: () => import(/* webpackChunkName: "login" */ '@/views/Login.vue')
    },
    {
        path: '/forgotPwd',
        name: 'forgotPwd',
        component: () => import(/* webpackChunkName: "forgotPwd" */ '@/views/ForgotPwd.vue')
    }, {
        path: '/dashBoard',
        name: 'dashBoard',
        component: () => import(/* webpackChunkName: "dashBoard" */ '@/views/DashBoard.vue'),
        meta: {
            pageType: '4',
            pageTitle: 'DashBoard',
            login: true
        }
    }, {
        path: '/adminConsole',
        name: 'adminConsole',
        component: () => import(/* webpackChunkName: "adminConsole" */ '@/views/AdminConsole.vue'),
        meta: {
            pageType: '4',
            pageTitle: 'Admin console',
            login: true
        }
    }, {
        path: '/users',
        name: 'users',
        component: () => import(/* webpackChunkName: "users" */ '@/views/users/Users.vue'),
        meta: {
            pageType: '2',
            pageTitle: 'Users',
            login: true
        }
    }, {
        path: '/personalInfo',
        name: 'personalInfo',
        component: () => import(/* webpackChunkName: "PersonalInfo" */ '@/views/users/PersonalInfo.vue'),
        meta: {
            pageType: '2',
            pageTitle: 'PersonalInfo',
            login: true
        }
    }, {
        path: '/appAccess',
        name: 'appAccess',
        component: () => import(/* webpackChunkName: "AppAccess" */ '@/views/users/AppAccess.vue'),
        meta: {
            pageType: '2',
            pageTitle: 'AppAccess',
            login: true
        }
    }, {
        path: '/userRoles',
        name: 'userRoles',
        component: () => import(/* webpackChunkName: "userRoles" */ '@/views/users/userRoles.vue'),
        meta: {
            pageType: '2',
            pageTitle: 'userRoles',
            login: true
        }
    },
    {
        path: '/parents',
        name: 'parents',
        component: () => import(/* webpackChunkName: "parents" */ '@/views/parents'),
        meta: {
            pageType: '4',
            pageTitle: 'Admin parents',
            login: true
        }
    },
    {
        path: '/parentsInfo',
        name: 'parentsInfo',
        component: () => import(/* webpackChunkName: "parentsInfo" */ '@/views/parents/parentsInfo.vue'),
        meta: {
            pageType: '4',
            pageTitle: 'parentsInfo',
            login: true
        }
    }, {
        path: '/connections',
        name: 'connections',
        component: () => import(/* webpackChunkName: "connections" */ '@/views/parents/connections.vue'),
        meta: {
            pageType: '4',
            pageTitle: 'connections',
            login: true
        }
    }, {
        path: "/settings",
        component: () => import(/* webpackChunkName: "settings" */ '@/views/subLayout.vue'),
        meta: {
            login: true
        },
        children: [{
            path: "general",
            name: "general",
            component: () => import(/* webpackChunkName: "general" */ '@/views/settings/general.vue')
        }, {
            path: "users",
            name: "settingUsers",
            component: () => import(/* webpackChunkName: "settingUsers" */ '@/views/settings/users.vue')
        }, {
            path: "companies",
            name: "companies",
            component: () => import(/* webpackChunkName: "companies" */ '@/views/settings/companies.vue')
        }]
    }, {
        path: "/companyInfo",
        name: "companyInfo",
        component: () => import(/* webpackChunkName: "companyInfo" */ '@/views/settings/companyInfo.vue'),
        meta: {
            login: true
        },
    }, {
        path: "/classes",
        name: "classes",
        component: () => import(/* webpackChunkName: "classes" */ '@/views/classes'),
        meta: {
            login: true
        },
    }, {
        path: "/classDetail/:id",
        name: "classDetail",
        component: () => import(/* webpackChunkName: "classDetail" */ '@/views/classes/classDetail'),
        meta: {
            login: true
        },
    }, {
        path: "/teachers",
        name: "teachers",
        component: () => import(/* webpackChunkName: "teachers" */ '@/views/classes/teachers'),
        meta: {
            login: true
        },
    }, {
        path: "/students",
        name: "students",
        component: () => import(/* webpackChunkName: "students" */ '@/views/classes/students'),
        meta: {
            login: true
        },
    }, {
        path: "/staff",
        name: "staff",
        component: () => import(/* webpackChunkName: "staff" */ '@/views/staff'),
        meta: {
            login: true
        },
    }, {
        path: "/staffInfo",
        name: "staffInfo",
        component: () => import(/* webpackChunkName: "staffInfo" */ '@/views/staff/staffInfo'),
        meta: {
            login: true
        },
    }, {
        path: "/staffInfoEdit",
        name: "staffInfoEdit",
        component: () => import(/* webpackChunkName: "staffInfoEdit" */ '@/views/staff/staffInfoEdit'),
        meta: {
            login: true
        },
    }, {
        path: "/privileges",
        name: "privileges",
        component: () => import(/* webpackChunkName: "staffInfoEdit" */ '@/views/staff/privileges'),
        meta: {
            login: true
        },
    }
]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router
